using UnityEngine;
using QFramework;

namespace XCZProject
{
	public partial class Coin : PowerUp
	{
		void Start()
		{
			// Code Here
		}
		
		private void OnTriggerEnter2D(Collider2D collider2D)
		{
			// 当碰撞的物体拥有“拾取范围”脚本时，则证明经验球碰到了玩家，增加经验并且删除该物体
			if (collider2D.GetComponent<CollectableArea>())
			{
				FlyingToPlayer = true;
			}
		}

		protected override void Execute()
		{
			AudioKit.PlaySound("coin");
			Global.Coin.Value++;
			this.DestroyGameObjGracefully();
		}

		protected override Collider2D Collider2D => SelfCollider2D;
	}
}
